package com.atao.baokede.AiTools;

import com.atao.baokede.service.ItemService;
import org.springframework.ai.support.ToolCallbacks;
import org.springframework.ai.tool.ToolCallback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 集中的工具注册类
 */
@Configuration
public class ToolRegistration {

    @Autowired
    private ItemService itemService;

    @Bean
    public ToolCallback[] allTools() {
        FileOperationTool fileOperationTool = new FileOperationTool();
        WebScrapingTool webScrapingTool = new WebScrapingTool();
        TerminateTool terminateTool = new TerminateTool();
        MysqlItemsTool mysqlItemsTool = new MysqlItemsTool(itemService);

        return ToolCallbacks.from(
                fileOperationTool,
                webScrapingTool,
                mysqlItemsTool,
                terminateTool
        );
    }
}